package org.example.jimeng;

import org.apache.commons.lang3.StringEscapeUtils;

/**
 * 图片生成和处理测试类
 */
public class ImageTest {
    
    public static void main(String[] args) {
        try {
            // 创建Sign实例
            String AccessKeyID = "AKLTMmExYmRkNTI4NjA5NDY2ZTkzZjFiMTkzNTA5YjkyNzg";
            String SecretAccessKey = "WlRaak56RmxOalk0WXpZeE5HWmpNamhsTmpkbE5qVXdOakpoWlRkaVlUaw==";
            String endpoint = "visual.volcengineapi.com";
            String path = "/";
            String service = "cv";
            String region = "cn-north-1";
            String schema = "https";
            
            Sign sign = new Sign(region, service, schema, endpoint, path, AccessKeyID, SecretAccessKey);
            
            // 测试1：纯文本生成图片
            System.out.println("=== 测试1：纯文本生成图片 ===");
            String result1 = sign.generateImage("一只可爱的小猫坐在花园里");
            System.out.println("生成结果: " + result1);


            String plain = StringEscapeUtils.unescapeHtml4(result1);
            System.out.println(plain);


            // 测试2：处理现有图片（如果有的话）
            // System.out.println("=== 测试2：处理现有图片 ===");
            // String inputImagePath = "src/main/resources/image/input.jpg";
            // String result2 = sign.processImage(inputImagePath, "将图片转换为卡通风格");
            // System.out.println("处理结果: " + result2);
            
        } catch (Exception e) {
            System.err.println("测试失败: " + e.getMessage());
            e.printStackTrace();
        }
    }
} 